package com.song.estore.action;

import com.song.estore.service.UserService;
import org.apache.struts2.ServletActionContext;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by 范姣姣 on 2015/10/22.
 */
public class ValidataAction {

    private String email;
    private UserService userService;

    public String execute() throws IOException {

        HttpServletResponse response = ServletActionContext.getResponse();
        boolean b = userService.findemailExists(email);
        response.setContentType("text/html;charset=utf-8");
        if( b ){
            response.getWriter().print("<font color='blue'>此账号已被注册</font>");
        }else{
            response.getWriter().print("<font color='red'>此账号可用</font>");
        }
        return null;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public void setUserService(UserService userService) {
        this.userService = userService;
    }
}
